﻿using System;
using NicoViewLib.Model;

using NicoViewLib.Model.Comments;
using NUnit.Framework;

namespace NicoView_Lib_UnitTest
{
    [TestFixture]
    public class NotifyNicoComment_UnitTest
    {



        [TestCase]
        public void NotifyDateCheck()
        {
            PropertyChange((c) =>
            {
                c.Date = new DateTime(2012, 11, 12);
            }, "Date");
        }

        [TestCase]
        public void NotifyElapsedCheck()
        {
            PropertyChange((c) =>
            {
                c.Elapsed = new TimeSpan(20, 23, 1);
            }, "Elapsed");
        }

        [TestCase]
        public void NotifyNoCheck()
        {
            PropertyChange((c) =>
            {
                c.No = 23;
            }, "No");
        }


        public void PropertyChange(Action<NotifyNicoComment> action, string name)
        {
            var comment = new NotifyNicoComment();
            var checkFlag = false;
            comment.PropertyChanged += (s, e) =>
            {
                checkFlag = true;
                Assert.AreEqual(e.PropertyName, name);
            };
            action(comment);
            Assert.IsTrue(checkFlag);
        }


        
    }
}
